home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
031-040
/
amok40
/
koord
/
koord.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
5KB
|
171 lines
(*
---------------------------------------------------------------------------
:Program. Koord.mod
:Contents. Mauskoordinaten des aktiven Windows mit Lupe.
:Author. Franz Dimbeck
:Address. Troppauerstraße 48, D-8058 Erding.
:Phone. 08122 18135
:Copyright. Public Domain
:Language. Oberon
:Translator. Oberon V1.0 Demo-Version AMOK#36 Fridtjof Siebert
:History. V1.0 Wednesday 27-Jun-90 21:20:29
---------------------------------------------------------------------------
*)
MODULE Koord;
IMPORT I: Intuition,
G: Graphics,
E: Exec,
D: Dos,
S: SYSTEM;
(* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
VAR
nx, (* nx+1=Zahl der Punkte für Lupe in x-Richtung *)
ny, (* ny+1=Zahl der Punkte für Lupe in y-Richtung *)
width,
height: INTEGER; (*Breite und Höhe des Fensters*)
KWin : I.NewWindow;
MyWinPtr,
activeWinPtr : I.WindowPtr;
firstScreenPtr,
oldScreenPtr : I.ScreenPtr;
rPtr,SrPtr : G.RastPortPtr;
intuiBasePtr : I.IntuitionBasePtr;
MyMsg : I.IntuiMessagePtr;
class : LONGSET;
Str : ARRAY 4 OF CHAR;
i : LONGINT;
x,y,k,j,lx,ly : INTEGER;
PROCEDURE OpenWin;
BEGIN
KWin.leftEdge := 0; ; KWin.topEdge := 0;
KWin.width := width; KWin.height := height;
KWin.minWidth := 71; KWin.minHeight := 20;
KWin.maxWidth := -1; KWin.maxHeight := -1;
KWin.blockPen := 3;
KWin.detailPen := 1;
KWin.idcmpFlags:= LONGSET{I.closeWindow,I.newSize};
KWin.flags := LONGSET{I.windowDrag,
I.windowSizing,
I.windowClose,
I.rmbTrap,
I.noCareRefresh,
I.activate};
KWin.title := S.ADR("KOORD - © 1990 Franz Dimbeck -PD- ");
KWin.screen := firstScreenPtr ;
KWin.type := I.customScreen ;
MyWinPtr := I.OpenWindow(KWin);
IF MyWinPtr=NIL THEN HALT(0) END;
rPtr := MyWinPtr.rPort;
I.SetWindowTitles
(MyWinPtr, -1 ,S.ADR(" KOORD - © 1990 Franz Dimbeck -PD- "));
G.SetAPen(rPtr,3);
G.RectFill(rPtr,0,10, width,height);
G.SetAPen(rPtr,1);
G.RectFill(rPtr,31,33,38,40);
END OpenWin;
PROCEDURE CloseWin;
BEGIN
IF MyWinPtr#NIL THEN I.CloseWindow(MyWinPtr) END;
MyWinPtr := NIL;
END CloseWin;
PROCEDURE ValToStr(i:INTEGER):LONGINT;
BEGIN
Str[0] := "+";
IF i<0 THEN Str[0] := "-" ; i := -i END;
Str[1] := CHR((i DIV 100)+ORD("0"));
Str[2] := CHR(((i MOD 100) DIV 10)+ORD("0"));
Str[3] := CHR((i MOD 10) + ORD("0"));
RETURN S.ADR(Str);
END ValToStr;
PROCEDURE DoIt;
BEGIN;
activeWinPtr := intuiBasePtr^.activeWindow;
rPtr.fgPen := 0;
rPtr.bgPen := 1;
G.SetDrMd(rPtr,G.jam2);
G.Move(rPtr,3,17);
G.Text(rPtr,ValToStr(activeWinPtr.mouseX),4);
G.Move(rPtr,35,17);
G.Text(rPtr,ValToStr(activeWinPtr.mouseY),4);
x := firstScreenPtr.mouseX;
y := firstScreenPtr.mouseY;
IF ny>=0 THEN
j := y-ny DIV 2; ly := 0;
LOOP
k := x-nx DIV 2; lx := 0;
LOOP
G.SetAPen(rPtr,SHORT(G.ReadPixel(SrPtr,k,j)));
G.RectFill(rPtr, 4+lx, 20+ly, 9+lx, 25+ly);
INC(lx,7);INC(k);
IF (lx>nx*7) THEN EXIT END;
END;
INC(ly,7);INC(j);
IF (ly>ny*7) THEN EXIT END;
END;
END; ;
LOOP
INC(i);
IF x#firstScreenPtr.mouseX THEN EXIT END;
IF y#firstScreenPtr.mouseY THEN EXIT END;
D.Delay(5);
IF i > 20 THEN
I.WindowToFront(MyWinPtr);
i := 0
END;
END;
END DoIt;
(* ----------- M A I N --------------- *)
BEGIN
i:=0;
nx:=8;
ny:=4;
width:= 70 ; height := 56;
intuiBasePtr := I.OpenIntuition();
MyWinPtr := NIL;
firstScreenPtr := intuiBasePtr^.firstScreen;
SrPtr := S.ADR(firstScreenPtr.rastPort);
OpenWin;
LOOP
DoIt;
MyMsg := E.GetMsg(MyWinPtr.userPort);
IF MyMsg # NIL THEN
class := MyMsg.class;
E.ReplyMsg(MyMsg);
IF (I.closeWindow IN class) THEN EXIT END;
IF (I.newSize IN class) THEN
G.SetAPen(rPtr,3);
width:=MyWinPtr.width; height:=MyWinPtr.height;
G.RectFill(rPtr,0,10,width,height);
nx:=(width-5) DIV 7 -1;
ny:=(height-20) DIV 7 -1;
G.SetAPen(rPtr,1);
IF ny>=0 THEN
G.RectFill(rPtr,3+nx DIV 2*7,19+ny DIV 2*7,
10+nx DIV 2*7,26+ny DIV 2*7);
END;
END;
END;
END; (* Trip away; *)
CloseWin; (* Make no stay; *)
END Koord. (* Meet me at the break of day. *)